package cn.stronglink.asset.module.sys.log.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import com.baomidou.mybatisplus.plugins.Page;

import cn.stronglink.asset.model.Permission;
import cn.stronglink.asset.model.SysOperateLog;
import cn.stronglink.asset.module.sys.log.service.SysLogService;
import cn.stronglink.suite.core.base.AbstractController;

@Controller
@RequestMapping(value = "sys/log")
public class SysLogController extends AbstractController {
	
	@Autowired
	private SysLogService sysLogService;
	
	@RequestMapping(value = "qryLog")
	public ResponseEntity<ModelMap> qryLog(ModelMap modelMap, HttpServletRequest request,
			HttpServletResponse response,@RequestBody Map<String, Object> params) {
		List<Permission> list = sysLogService.qryPermission(params);
		return setSuccessModelMap(modelMap, list);
	}
	
	@RequestMapping(value = "qryList")
	public ResponseEntity<ModelMap> qryList(ModelMap modelMap, HttpServletRequest request,
			HttpServletResponse response,@RequestBody Map<String, Object> params) {
		Page<SysOperateLog> page = (Page<SysOperateLog>) super.getPage(params);
		Page<SysOperateLog> data = sysLogService.qryList(page,params);
		return setSuccessModelMap(modelMap, data);
	}
	
	@RequestMapping(value = "qryById")
	public ResponseEntity<ModelMap> qryById(ModelMap modelMap, HttpServletRequest request,
			HttpServletResponse response,@RequestBody Long id) {
		SysOperateLog data = sysLogService.qryById(id);
		return setSuccessModelMap(modelMap, data);
	}
}
